package com.hsgene.pay.service.api;

import com.hsgene.common.util.result.ApiResult;
import com.hsgene.common.util.result.NullObject;
import com.hsgene.order.domain.v1.GeneticTestingOrder;
import com.hsgene.order.domain.v1.GeneticTestingOrderAddtionA;
import com.hsgene.order.domain.v1.GeneticTestingOrderInterchange;
import com.hsgene.pay.service.api.impl.OrderInternalApiServiceImpl;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;

/**
 * 订单内部API调用
 *
 * @author wangbing
 * @version 1.0, 2018/10/9
 */
@FeignClient(value = "ms-mod-order", path = "/order/internal", fallback = OrderInternalApiServiceImpl.class)
public interface OrderInternalApiService {

    /**
     * 根据id获取订单信息
     *
     * @param orderId 订单id
     * @return 订单信息
     */
    @GetMapping("testing_order/{orderId}")
    ApiResult<GeneticTestingOrder> getTestingOrder(@PathVariable("orderId") String orderId);

    /**
     * 根据interchangeId获取订单变更信息
     *
     * @param interchangeId 订单变更id
     * @return 订单变更信息
     */
    @GetMapping("testing_order_interchange/{interchangeId}")
    ApiResult<GeneticTestingOrderInterchange> getTestingOrderInterchange(@PathVariable("interchangeId") String interchangeId);

    /**
     * 根据订单id获取订单附加A信息
     *
     * @param orderId 订单id
     * @return 订单附加A信息
     */
    @GetMapping("testing_order_addition_a/{orderId}")
    ApiResult<GeneticTestingOrderAddtionA> getTestingOrderAdditionA(@PathVariable("orderId") String orderId);

    /**
     * 套餐变更支付回调
     *
     * @param interchangeId 变更记录id
     * @param amount        支付金额
     * @return 回调结果
     */
    @PutMapping("interchange/callback")
    ApiResult<NullObject> payInterchangeCallBack(
            @RequestParam("interchangeId") String interchangeId,
            @RequestParam("amount") BigDecimal amount);
}
